
function initFlexSlider(){
	 $j('.flexslider').flexslider({
		animationLoop: true,
		controlNav: false,
		useCSS: false,
		pauseOnAction: true,
    pauseOnHover: true,
		slideshow: true,
		animation: "slide",
		animationSpeed: 600,
		slideshowSpeed: 8000,
		start: function(){
			setTimeout(function(){$j(".flexslider").fitVids();},100);
			
		}
	});
	
	$j('.flex-direction-nav a').click(function(e){
		e.preventDefault();
		e.stopImmediatePropagation();
		e.stopPropagation();
	});
}


var line_height = 79;
var dropDown1Top = 79 - 27;
var dropDown2Top = 79 - 8;
var dropDown3Top = 79 + 3;
var contentTop = 79 + 3;
var logo_height; // it's value is calculated in window load function

function headerSize(scroll){

	if((line_height - scroll) > 60){		
		$j('header.header_top_fixed nav.main_nav > ul > li > a').css('line-height', line_height - scroll+'px');
		$j('header.header_top_fixed .drop_down .second').css('top', dropDown1Top - scroll+'px');
		$j('header.header_top_fixed .drop_down2 .second').css('top', dropDown2Top - scroll+'px');
		$j('header.header_top_fixed .drop_down3 .second').css('top', dropDown3Top - scroll+'px');
		
		if($j('header').hasClass('header_top_fixed')){
		if($j('.header_top_outer').length > 0){
			$j('.content').css('padding-top',contentTop+30-scroll);
		}else{
			$j('.content').css('padding-top',contentTop-scroll);
		}
		}
	}else if((line_height - scroll) < 60){
		$j('header.header_top_fixed nav.main_nav > ul > li > a').css('line-height', 57+'px');
		$j('header.header_top_fixed .drop_down .second').css('top', 38+'px');
		$j('header.header_top_fixed .drop_down2 .second').css('top', 49+'px');
		$j('header.header_top_fixed .drop_down3 .second').css('top', 60+'px');
		
		if($j('header').hasClass('header_top_fixed')){
		if($j('.header_top_outer').length > 0){
			$j('.content').css('padding-top',60+30-4);
		}else{
			$j('.content').css('padding-top',60-4);
		}
		}
	}
	if($j('header').hasClass('header_top_fixed')){
		if((line_height - scroll < logo_height) && (line_height - scroll) > 60 && logo_height > 55){
			$j('.logo img').height(line_height - scroll - 20);
		}else if((line_height - scroll < logo_height) && (line_height - scroll) < 60 && logo_height > 55){
			$j('.logo img').height(60 - 20);
		}else if(scroll == 0 && logo_height > 55){
			$j('.logo img').height(logo_height);
		}
	}
	
}

function setLogoHeightOnLoad(){
	if(line_height < logo_height && line_height > 60 && logo_height > 55){
		$j('.logo img').height(line_height - 20);
	}else if(line_height < logo_height && line_height < 60 && logo_height > 55){
		$j('.logo img').height(60 - 20);
	}else if(logo_height > 55){
		$j('.logo img').height(logo_height);
	}
}